package com.xiaoying.server.publish.utils;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

import redis.clients.jedis.Jedis;

import com.xiaoying.server.publish.entity.FileInfo;

public class RedisUtilTest2 {

	
	
	@Test
    public void test_map_set_null(){
    	Jedis redis = RedisUtil.getRedisInstance();
		Map<String, String> map = new HashMap<String, String>();
		String key="keynull_1";
		map.put("id", "1");
		map.put("fileName", "fileName");
		map.put("filePath", "filePath");
		map.put("fileSize", "12");    		
		map.put("fileSuffix", "fileSuffix");
		map.put("fileType", "12");
		map.put("uploadCount", "12");
		map.put("receiveDt", "receiveDt");		    		
		redis.hmset(key, map);	
		map = null;
		key = null;
		
		String fuzzykey = "keynull_1";	
		int id = Integer.valueOf(redis.hget(fuzzykey,"id"));
		String fileName = redis.hget(fuzzykey,"fileName");
		String filePath = redis.hget(fuzzykey,"filePath");
		long fileSize = Long.valueOf(redis.hget(fuzzykey,"fileSize"));    		
		String fileSuffix = redis.hget(fuzzykey,"fileSuffix");
		short fileType = Short.valueOf(redis.hget(fuzzykey,"fileType"));
		int uploadCount = Integer.valueOf(redis.hget(fuzzykey,"uploadCount"));
		String receiveDt = redis.hget(fuzzykey,"receiveDt");		
		FileInfo fileInfo = new FileInfo(id,fileName,filePath,
				fileSize,fileSuffix,fileType,uploadCount,receiveDt);
		System.out.println(fileInfo.getFileName());
		
    }
}
